1. The Field of the Invention
The present invention relates to systems and methods for rendering visual effects that are a function of depth. More specifically, the present invention is directed to systems and methods for accurately and realistically rendering visual effects such as fog, colored liquids, gels, smoke, mists, and the like for which the visual appearance of the effects can change with respect to depth and for which the effects are rendered on an output device so as to be generally contained.
2. Background and Related Art
Computer systems exist that are capable of generating and displaying three-dimensional objects through the use of an output device, such as a monitor or printer. The output device provides a two-dimensional space on which the three-dimensional objects are displayed. The three-dimensional objects are created using an X-Y scale to provide the objects with the properties of width and height, and an imaginary Z-axis to further provide the property of depth. On the X-Y-Z scale, a rendering pipeline models the objects through the use of primitives or polygons that provide the overall structure for the objects and upon which textures, such as color and shade, may be applied.
Conventional rendering techniques add visual effects to computer graphics to provide realism. The visual effects may utilize depth by layering an opaque object in such a way as to partially hide another object that is behind the opaque object so as to give the appearance of depth. The visual effects may also utilize depth by rendering an opaque object through a partially transparent or translucent item, such as when fog or mist is rendered to surround an opaque object.
To render a partially transparent or translucent visual effect, such as fog, mist, haze, colored liquid, etc., conventional rendering techniques utilize a linear or exponential algorithm that renders visibility as a function of depth. By way of example, and with reference to FIG. 1A, a visibility curve 10 is illustrated that corresponds to an algorithm for rendering a partially transparent or translucent visual effect. The curve divides the visibility that may be rendered due to a partially transparent or translucent visual effect into three visibility regions. The visibility regions include transparent region 11a, partially transparent region 11b, and opaque region 11c, which model the way that objects are perceived in the real world.
When a partially transparent or translucent visual effect is to be rendered on an output device so as to appear to surround an opaque object, the viewpoint, or camera, 12 is placed at the vertical axis (i.e., depth=0), and the opaque object 13 is placed at some depth along the horizontal depth axis. The rendering of the visual effect is performed by projecting a point, such as a front primitive point of opaque object 13 onto the visibility curve 10 to obtain a visibility value (i.e. 0.4), which indicates the amount of the transparent or translucent effect that is to be blended to the front primitive point. This process is performed for each of the pixels in order to render the desired effect, as illustrated in FIG. 1A as object 13b of display screen 15b. As illustrated, when the visibility value is between 0.0 (completely opaque) and 1.0 (completely transparent) the object is rendered as being partially transparent, as illustrated by object 13b. The surrounding background 14b is rendered to have a greater depth value than object 13b and thus the background 14b is illustrated as being completely opaque Therefore, the foregoing process partially obscures opaque object 13b when the opaque object is positioned in the partially transparent region 11b. 
Alternatively, if the opaque object were placed within the transparent region 11a, the points projected onto visibility curve 10 would obtain a visibility value of 1.0 for all of the projected points of the object, indicating that there is full visibility of the opaque object. As such, an output device would render the opaque object without rendering any of the visual effect. This is illustrated in FIG. 1A as opaque object 13a that is rendered on display screen 15a. However, since the surrounding background 14a is rendered to have a greater depth value than object 13a, background 14a is illustrated as being completely opaque. Thus, the foregoing process does not obscure an object 13a that is positioned in the transparent region 11a. 
If the opaque object were placed within the opaque region 11c, the points projected onto visibility curve 10 would yield a visibility value of 0.0 for all of the projected points of the object, indicating that there is no visibility of the opaque object. As such, the visibility of the opaque object would be completely obscured. An output device would render the visual effect in a maximum/opaque manner, thereby preventing the rendering of the opaque object. This is illustrated in FIG. 1A as display screen 15c, which includes background 14c that is also opaque due to depth. Therefore, the foregoing process completely obscures an object that is positioned in the opaque region 11c. 
Thus, as illustrated in FIG. 1A, the extent to which a partially transparent or translucent visual effect is rendered varies with depth. The linear or exponential algorithm applies the effect to the primitives having a depth value between where the effect is to start and where effect is to end. No effect is applied to primitives having a depth value less than where the effect is to start in order to yield full visibility. Similarly, a maximum effect is applied to primitives having a depth value greater than where the effect is to end in order to completely obscure visibility.
While conventional techniques adequately render the desired perception where the visual effect linearly or exponentially exists in the entire field of view, existing techniques have not been able to accurately render the situation where the visual effect is generally contained to a specific area. Such situations arise when the visual effect is present, for example, within a translucent object, such as when fog or colored liquid is to be rendered inside an enclosed glass bottle.
By way of example, and with reference to FIG. 1B, if an opaque object 13 in a translucent bottle 18, which is filled with colored liquid (not shown), were to be rendered using existing techniques, the following steps would occur. First, the primitive on the visible surface of the opaque object 13 would be applied to the frame buffer under the assumption that the colored liquid exists between the primitive and the viewpoint 17. Next, a primitive at the front surface of the translucent bottle 18 would be applied to the same pixel of the frame buffer.
This process generates an excess contribution of the translucent visual effect (the colored liquid) that is applied to the primitive on the visible surface of object 13 since there is no colored liquid that is to be rendered between the front of the translucent bottle 18 and the viewpoint 17. Furthermore, since the primitive of the front surface of the opaque object has already been blended into the pixel value stored in the frame buffer, there is no convenient way of subtracting the excess contribution of the translucent effect.
Furthermore, this problem cannot be fully solved by subtracting the depth value of the opaque object from the depth value of the translucent bottle prior to generating the translucent effect value, since the translucent effect is generally not linear between the viewpoint 17 and the object 13. By way of example, and with reference to FIG. 1B, the depth value of the front surface of opaque object 13 is a known value and is illustrated as xe2x80x9cDEPTH1.xe2x80x9d Similarly, the depth value of the front surface of the translucent bottle 18 is a known value and is illustrated as xe2x80x9cDEPTH2.xe2x80x9d The difference (xcex94D) between the depth value of the front surface of the opaque object 13 and the depth value of the front surface of the translucent bottle 18 can be obtained by subtracting DEPTH2 from DEPTH1. Applying the value of AD to the visibility curve 10 renders a visibility value of 1.0 for xcex94D, which renders full visibility of opaque object 13. Therefore, subtracting DEPTH2 from DEPTH1 does not model the visibility of opaque object 13 in the manner in which it would be perceived in the real world, since the visibility of opaque object 13 is not diminished according to the foregoing technique.
Thus, while conventional techniques can adequately render the desired perception of a partially transparent or translucent visual effect that linearly or exponentially exists in the entire field of view, the existing techniques are not able to accurately render the situation where the visual effect is generally contained to a specific area.
The present invention relates to systems and methods for rendering visual effects that are a function of depth. More specifically, the present invention is directed to systems and methods for accurately and realistically rendering visual effects such as fog, colored liquids, gels, smoke, mists, and the like for which the visual appearance of the effects can change with respect to depth and for which the effects are rendered on an output device so as to be generally contained.
Implementation of the present invention takes into account the distance of the primitive from the viewer, the depth of the segment of the visual effect that is to be applied to the primitive, and the non-linearity of the visual effect function. A visibility curve is utilized to obtain visibility values for a given pixel based on the depth at which the segment of the visual effect begins and ends. Once obtained, the visibility values are passed to an adjustment function in order to yield an adjusted visibility value that is applied to the pixel. This process of obtaining visibility values, passing the visibility values to an adjustment function to obtain an adjusted visibility value, and applying the adjusted visibility value to a pixel, is performed for every pixel of a display screen that is to be used to accurately render a desired visual effect that can change with respect to depth and for which the effect is rendered on a display screen so as to be generally contained.
In contrast to obtaining a difference (xcex94D) between the depth value at which the segment of the visual effect begins and the depth value at which it ends (e.g, the front surface of the opaque object) prior to obtaining visibility values, implementation of the present invention includes applying these two depth values to the visibility curve to obtain two visibility values associated with the visual effect and then identifying the difference between the resulting two visibility values. By way of example, to render an opaque object within a bottle that is filled with colored liquid in accordance with the present invention, a depth value of the front surface of the translucent bottle is applied to a visibility curve to obtain a corresponding visibility value for the front surface of the translucent bottle. Similarly, a depth value of the front surface of the opaque object is applied to the visibility curve to obtain a corresponding visibility value for the front surface of the opaque object. The visibility values for the front surface of the translucent bottle and for the front surface of the opaque object are passed to an adjusted visibility function, where the difference between the two visibility values is used as the basis for an adjusted visibility value. The adjusted visibility value is a factor applied to the luminous intensity values associated with the pixel to decrease the visibility of the opaque object. Calculating the adjusted visibility value in the foregoing manner results in a rendered image that models the way that the visual effect, which can change with respect to depth and for which the effect is generally contained, would be perceived in the real world.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the invention. The features and advantages of the invention may be realized and obtained by means of the instruments and combinations particularly pointed out in the appended claims. These and other features of the present invention will become more fully apparent from the following description and appended claims, or may be learned by the practice of the invention as set forth hereinafter.